
n=int(input())
arr=list(map(int,input().split()))

def getResult():
    stack=[]
    res=[0]*len(arr)
    for i in range(0,len(arr)):
        ele=arr[i]
        while True:
            if len(stack)==0:
                stack.append([ele,i])
                break
            topEle,topIndex=stack[-1]
            if ele>topEle:
                res[topIndex]=i
                stack.pop()
            else:
                stack.append([ele,i])
                break
    return " ".join(map(str,res))
print(getResult())